/*
 * Cube.h
 *
 *  Created on: 31.1.2013
 *      Author: Travis
 */

#pragma once

#include "../ShaderPool.h"

#ifdef _WIN32 
#include <windows.h> 
#endif

#include <glm/glm.hpp>
#include <vector>
#include "Rectangle2D.h"
#include "../scene/World.h"
#include <glm/gtc/matrix_transform.hpp>

namespace World
{
class World;
}

namespace DataTypes
{

class Cube
{
public:
	Cube(std::vector<glm::vec3> _vertexes);
	Cube(float _size);
	Cube(glm::vec3 _center, float _size);
	Cube(glm::vec3 _center, float _size_x, float _size_y);
	virtual ~Cube();

	// add this number to all points of cube
	void Scale(float add);

	// return diagonal size from A to C
	// base side (bottom)
	float GetDiagonalOfBase();

	// check collision cube - point in 3D
	// cube coud be rotated and translated to custom position
	// angle - angle of rotation (only around Y axis)
	// pos - position of cube
	// x - point
	// return TRUE when collision is detected
	bool pointInCube(float angle, glm::vec3 pos, glm::vec3 X);
	bool pointInCube(glm::vec3 X);

	// collision with cube
	// return TRUE when collision is detected
	bool cubeInCube(Cube cube);
	bool cubeInCubeThisMoved(Cube cube, float angle, glm::vec3 pos);

	void printCube();
	void drawCube();
	void drawCube(glm::vec3 pos, float angle, glm::vec3 color);

	const std::vector<glm::vec3>& getVertexes() const;
	void setVertexes(const std::vector<glm::vec3>& vertexes);
	const glm::vec3& getCenter() const;
	void setCenter(const glm::vec3& center);
	float getSize() const;
	void setSize(float size);

private:
	// cube points
	std::vector<glm::vec3> vertexes;
	float size, size_x, size_y;
	glm::vec3 center;

	GLuint shaderID;
};
}
